package com.demoworld;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

/**
 * Created by liwei.b on 2017/6/22.
 */
public class NewCachedThreadPoolDemo {
    static ExecutorService pool = Executors.newCachedThreadPool();

    public static void test() {
        pool.execute(new MyTask(1, "111"));
        pool.execute(new MyTask(2, "222"));
        pool.execute(new MyTask(3, "333"));
        pool.execute(new MyTask(4, "444"));

        try {
            Thread.sleep(1000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }

        pool.shutdown();

    }
}
